package demo.entity;

import lombok.Data;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.Table;
import java.io.Serializable;

/**
 * 测试联合主键
 *
 * Created by 张少昆 on 2018/1/29.
 */
@Data
@Entity
@Table
@IdClass( Relation.RelationKey.class)
public class Relation {

    @Id
    private long id;
    @Id
    private long userId;
    @Id
    private long studentId;

    private int see;

    @Data
    public static class RelationKey implements Serializable {
        private long id;
        private long userId;
        private long studentId;
    }
}
